import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;

import javax.swing.*;
import javax.swing.border.LineBorder;

/**
 * Denne klassen lager et simpelt view for å legge til nye avtaler å se 
 * avtaler
 *  
 * @author Kristian
 */

public class GUICalendar extends JFrame {

	public static void main(String args[]) {
		GUICalendar gui = new GUICalendar();
	}

	//Variabler
	JLabel loggedInAsLabel;
	JButton addAppointmentButton;
	JButton viewCalendarButton;
	JFrame frame;

	JList membersList;
	JScrollPane JSP;
	
	JLabel membersListLabel;
	JLabel loginLabel;
	JLabel appointmentPlaceLabel;
	JLabel appointmentTimeLabel;
	JLabel appointmentDateLabel;
	JLabel newAppointmentLabel;

	//Legge til info om nye avtaler
	JTextField newAppointmentField;
	JTextField appointmentDateField;
	JTextField appointmentTimeField;
	JTextField appointmentRoomField;
	JTextField loggedInAsField;

	//Møte agenda area
	JTextArea appointmentAgendaArea;

	public GUICalendar() {
		GridBagConstraints c = new GridBagConstraints();

		//Selve framen
		frame = new JFrame("Legge til ny avtale");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(500, 400);
		frame.setLayout(new GridBagLayout());
		frame.setResizable(false);
		frame.setVisible(true);

		//Logget inn som label
		loggedInAsLabel = new JLabel("Logget inn som:");
		c.weightx = 0.5;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 0;
		c.insets = new Insets(0, 0, 50, 0);
		frame.add(loggedInAsLabel, c);

		//Logget inn som felt
		loggedInAsField = new JTextField();
		c.weightx = 1.0;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 1;
		c.gridy = 0;
		c.insets = new Insets(0, 0, 50, 0);
		loggedInAsField.isEditable();
		frame.add(loggedInAsField, c);

		//Ny avtale label
		newAppointmentLabel = new JLabel("Ny Avtale: ");
		c.weightx = 0.5;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 1;
		c.insets = new Insets(0, 0, 50, 0);
		frame.add(newAppointmentLabel, c);

		//Ny avtale felt
		newAppointmentField = new JTextField();
		c.weightx =1;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 1;
		c.gridy = 1;
		c.weightx = 2;
		c.insets = new Insets(0, 0, 50, 0);
		frame.add(newAppointmentField, c);

		//Ny avtale label
		membersListLabel = new JLabel("Deltakere: ");
		c.weightx = 1;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 1;
		c.insets = new Insets(20, 0, 0, 0);
		frame.add(membersListLabel, c);
		
		//Liste over deltakere til møtet
		String[] data = {"one", "two", "three", "four"};
		membersList = new JList(data);

		JSP = new JScrollPane(membersList);
		membersList.setMinimumSize(new Dimension(150,100));
		JSP.getViewport().add(membersList);
		
		c.weightx = 1.0;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 1;
		c.gridy = 1;
		c.insets = new Insets(20, 0, 0, 0);
		loggedInAsField.isEditable();
		frame.add(JSP, c);
		
		//Møtedato label
		appointmentDateLabel = new JLabel("Møtedato: ");
		c.weightx = 0.5;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 2;
		c.insets = new Insets(0, 0, 10, 0);
		frame.add(appointmentDateLabel, c);

		//Møtedato felt
		appointmentDateField = new JTextField("Møtedato");
		c.weightx = 1;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 1;
		c.gridy = 2;
		c.insets = new Insets(0, 0, 10, 0);
		frame.add(appointmentDateField, c);

		//Møtedato label
		appointmentPlaceLabel = new JLabel("Møtested: ");
		c.weightx = 1;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 3;
		c.insets = new Insets(0, 0, 0, 0);
		frame.add(appointmentPlaceLabel, c);

		//Møtested felt
		appointmentRoomField = new JTextField("Møtested");
		c.weightx = 0.5;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 1;
		c.gridy = 3;
		c.gridheight = 1;
		c.gridwidth = 1;
		c.insets = new Insets(0, 0, 0, 0);
		frame.add(appointmentRoomField, c);

		//Legg til møte knapp
		addAppointmentButton = new JButton("Legg til møte");
		c.weightx = 0.5;
		c.ipady = 40;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 5;
		c.gridheight = 1;
		c.gridwidth = 1;
		c.insets = new Insets(30, 0, 0, 0);
		frame.add(addAppointmentButton, c);

		//Se kalender knapp
		viewCalendarButton = new JButton("Se kalender");
		c.weightx = 1;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 1;
		c.gridy = 5;
		c.gridheight = 1;
		c.gridwidth = 1;
		c.insets = new Insets(30, 0, 0, 0);
		frame.add(viewCalendarButton, c);

		//Møte agenda area
		appointmentAgendaArea = new JTextArea(40, 4);
		appointmentAgendaArea.setBorder((new LineBorder(new java.awt.Color(0,0,0), 1, false)));
		c.weightx = 1;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 4;
		c.gridheight = 1;
		c.gridwidth = 3;
		c.insets = new Insets(10, 0, 0, 0);
		frame.add(appointmentAgendaArea, c);


	}
}